﻿using IKE.LCAFormat.ILCD;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Xml.Schema;
using System.Xml;
using IKE.LCAFormat.ILCD.Process;
using IKE.LCAFormat.ILCD.Common;

namespace IKE.LCAFormatTest
{
    
    
    /// <summary>
    ///This is a test class for ProcessDataSetTest and is intended
    ///to contain all ProcessDataSetTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ProcessDataSetTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        [TestInitialize()]
        public void MyTestInitialize()
        {
            Helper.LangKey = "en";
        }
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Populate
        ///</summary>
        [TestMethod()]
        public void PopulateTest()
        {
            ProcessDataSet target = new ProcessDataSet(); // TODO: Initialize to an appropriate value
            
            #region 构建一个测试对象
            var processInformation = target.processInformation;
            var dataSetInformation = processInformation.dataSetInformation;
            dataSetInformation.UUID = new Guid("4f035020-4599-424d-8f48-627b35dd1a7f");
            var name = dataSetInformation.name;
            name.baseName.Add(new StringMultiLang
            {
                lang = "en",
                Value = "Waste incineration of municipal solid waste (MSW)"
            });
            name.treatmentStandardsRoutes.Add(new StringMultiLang
            {
                lang = "en",
                Value = "average European waste-to-energy plant, without collection, transport and pre-treatment"
            });
            name.mixAndLocationTypes.Add(new StringMultiLang
            {
                lang = "en",
                Value = "at plant"
            });
            var synonyms = dataSetInformation.synonyms;
            synonyms.Add(new StringMultiLang
            {
                lang = "en",
                Value = "Waste-to-energy of MSW"
            });
            var classification = dataSetInformation.classificationInformation.classification;
            var classfiication1 = new ClassificationType();
            classification.Add(classfiication1);
            classfiication1.@class.AddRange(new List<ClassType>{ 
                    new ClassType{
                        level=0,
                        Value="End-of-life treatment"
                    },
                    new ClassType{
                        level=1,
                        Value="Energy recycling"
                    }
            });
            var generalComment = dataSetInformation.generalComment;
            generalComment.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The European average Waste-to-Energy plant (WtE) is defined based on the treatment of average European municipal solid waste (MSW). The thermal treatment of a single waste fraction like paper or plastic or even specific wastes like Polyamide 6 is not done in reality in a WtE plant for MSW. The waste is always homogenized to obtain a relative constant calorific value and to comply with the emission standards. Nonetheless the used model and the used settings for the average MSW allows to attribute the environmental burden (emissions and also resource consumption of auxiliaries) energy production as well as the credits (metal scrap export) to a single fraction or specific waste incinerated within an average MSW. Therefore the LCI data is valid for the treatment of the specific waste within an average MSW (the waste fraction share of the MSW is shown in the pie chart beneath, the elementary composition in the first table beneath). The following technology description explains the settings and technology of the average WtE plant used to generate the LCI data set. The net calorific value and the elementary composition of the waste fraction or specific waste are shown in the tables beneath (see corresponding column in the tables). The data set covers all relevant process steps / technologies over the supply chain of the represented cradle to gate inventory with a good overall data quality. The inventory is mainly based on industry data and is completed, where necessary, by secondary data."
            });
            var quantitativeReference = processInformation.quantitativeReference;
            quantitativeReference.type = 1;
            quantitativeReference.referenceToReferenceFlow.Add(0);
            var time = processInformation.time;
            time.referenceYear = 2006;
            time.dataSetValidUntil = 2010;
            time.timeRepresentativenessDescription.Add(new StringMultiLang
            {
                lang = "en",
                Value = "Annual average"
            });
            var geography = processInformation.geography;
            geography.locationOfOperationSupplyOrProduction.location = "EU-27";
            geography.locationOfOperationSupplyOrProduction.descriptionOfRestrictions.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The data set represents a typical European situation (EU-27 + CH and NO). A mix off dry and wet flue gas cleaning and different NOx removal technologies (SCR = Selective Catalytic Reduction and SNCR = Selective Non-Catalytic Reduction) is applied representing the actual application in the EU-27 countries, Switzerland and Norway."
            });
            var technology = processInformation.technology;
            technology.technologyDescriptionAndIncludedProcesses.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The data set represents an average European waste-to-energy plant (WtE) for the thermal treatment of municipal solid waste (MSW) with typical technology used in Europe to meet the legal requirements. Environmental impacts for waste collection, transport or any pretreatment of the waste are not included in the data set. Two different incineration models one with a wet and one with a dry flue gas treatment (FGT) and different NOx-removal technologies are mixed to represent the appliance of the different FGT systems in Europe. According to data published in the BREF document \"Waste Incineration\" of the European Commission (2006) two-thirds of the MSW is treated within a plant operating with a dry FGT and one-third of the MSW is incinerated within a plant with a wet FGT. For the NOX reduction a share of two-third SNCR (Selective Non-Catalytic Reduction) and one-third SCR (Selective Catalytic Reduction) is used. The plant consists of an incineration line fitted with a grate and a steam generator. The average efficiency of the steam production is about 81.9%. Produced steam is used internally as process-steam and the balance is used to generate electricity or exported as heat to industry or households. An energy balance for the plant was made using data from the \"CEWEP Energy Report\" (2006) representing 97 waste-to energy plants in Europe. Beside one 1t of MSW with a lower calorific value of approximately 10 GJ/t electricity (0.06 GJ/t of MSW) as well as fuels and heat (0.22 GJ/t of MSW) are imported. 1.09 GJ electricity and 3.16 GJ thermal energy per ton of threaten MSW are distributed to the grid and industrial customers. The effective exported electricity is reduced by 7% due to grid losses (European average). All utilities used in the waste incineration plant, the operation of the underground deposit and the landfill for bottom ash and air pollution control (APC) residues as well as the meltdown processes for the recovered metals are included in the system. Dry FGT: The flue gas treatment system uses a dry technology with adsorbent and a SNCR system for NOx-reduction. The NOx reducing agent ammonia is directly injected into the furnace and reacts with the NOx to nitrogen and water. The flue gas is conditioned, adsorbents added and filtered with fabric filters. Lime milk and small parts of hearth furnace coke are used as adsorbents; a part of the adsorbents is re-circulated. The fly ash together with the adsorbent is mixed together with the boiler ash (treatment of APC residues see below). Wet FGT: The flue gas treatment system uses a pre-dusting stage and an additional downstream deduster both fabric filters and wet scrubbers to clean the flue gas. After leaving the pre-dedusting stage used to reduce the dust load before the wet scrubbers, the flue gas is feed into the water of the first wet scrubber. Mainly HF and HCl are removed in the first stage. The deposition of sulphur dioxide in the very acid medium of the first stage (pH 0-1) is low and requires a second wet scrubber to remove SO2. Lime milk, hearth furnace coke and trass are used as adsorbents in the filters and scrubbers. The wet scrubbers are operated waste water free. A purification of the brine from the first scrubber to hydrochloric acid and the sulphate slurry from the second scrubber to gypsum is not done. All residues are treated together as APC residues (see below). As final treatment stage the flue gas passes a SCR system to reduce NOx. Due to the quenching of the flue gas in the wet scrubber and the temperature requirements of the SCR catalyst the flue gas has to be reheated. Emissions: For the emissions HCl, HF, NOx, VOC, N2O, CO, NH3, SO2, dust, dioxin and the heavy metals As, Cd, Co, Cr, Ni and Pb mean emission values per cubic meter of cleaned flue gas published in the BREF document \"Waste Incineration\" of the European Commission are used. Due to the wide range of emissions for some elements and substances the mathematical mean values are adjusted with additional real plant data. The emission of all other elements and the distribution of all elements and substances into the different residues are calculated by means of transfer coefficients (see model description below). Treatment of residues: The bottom ash approximately 220kg/t of MSW (approximately 195 kg/t of MSW without metals) is quenched, metals (Fe, Al, Cu, Zn and Pb) are recovered (the recovered Fe represents 10%, the Al 1% and Cu, Zn and Pb 0.6% of the bottom ash) and a three month ageing process is done to stabilize the bottom ash. 60% of the produced bottom ash after metal recovery and ageing is reused as construction material (and will leave the system as bottom ash for reuse). The remaining 40% are disposed on a landfill. To consider the transfer of elements of the bottom ash into ground water, water bodies or air leachate tests for bottom ash and standard leakage rates for landfills are used. According to the current situation in Europe APC residues (42kg/t of MSW) including boiler ash, filter cake and slurries are disposed in salt mines (43%) or landfills (57%). The disposal in salt mines without free water and contact to ground water reservoirs was modelled as emission free. The operation of the underground deposit is included. The landfill was modelled similar to the bottom ash using leachate test data for APC residues. Transports for bottom ash and APC residues independent of the different routes are considered. To calculate the credits for the metal recovery standard metal production data sets of the GaBi 4 Software were used. To obtain the same metal quality like the used data sets for the crediting the scrap has to be remelted and processed. The environmental burdens for the remelting and processing are taken into account in the system boundaries."
            });
            technology.technologicalApplicability.Add(new StringMultiLang
            {
                lang = "en",
                Value = "Standard end-of-life treatment service for average European municipal waste via thermal treatment."
            });
            technology.referenceToTechnologyFlowDiagrammOrPicture.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("f1b05ac0-f1ee-11dd-ba2f-0800200c9a66"),
                version = "02.00.000",
                type = 1,
                uri = "../sources/f1b05ac0-f1ee-11dd-ba2f-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new StringMultiLang{  
                        lang="en",
                        Value="PE_LBP-GaBi_End-of-Life_Waste_incineration_flowchart_partly_terminated_f1b05ac0-f1ee-11dd-ba2f-0800200c9a66.jpg"
                    }
                }
            });
            var mathematicalRelations = processInformation.mathematicalRelations;
            mathematicalRelations.modelDescription.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The model is build for the described technology and verified with measured data from several German incinerators, further literature data and experts of CEWEP. The heating value of the input is calculated based on the elementary specification of the input. The material flow in the plant is calculated using individual transfer coefficients for every element and stage of the incinerator. An exception are the emission of some substances and heavy metals into the air listed in the table \"Used emission values for the flue gas after FGT\" above. For the input specification in the model the following elements and compounds are addressed: Ag, Al, AlOx, As, ash, Ba, Br, C (fossil, biogenic, inorganic), Ca, Cd, Cl, CN, Co, Cr, Cu, F, Fe, H, H2O, Hg, J, K, Mg, Mn, N, Na, NH4, Ni, O, P, Pb, S, Sb, SiO2, Sn, SO4, Ti, Tl, V, Zn. The modelled emissions to air in the flue gas of the incinerator are: As, Ba, Cd, Co, CO, CO2, Cr, Cu, dioxins, HBr, HCl, HF, HJ, Hg, Mn, N2O, NH3, Ni, NMVOC, NOx, particles, Pb, Sb, Sn, SO2, Tl, V, Zn. In addition slag, boiler and filter ash and recycled metals are modelled. The transfer of the elements and substances into the different mediums (bottom ash, APC residues and air) is done with transfer coefficients based on real plant data, literature and experts. Some of the elements respectively tracked substances leaving the system are input dependent. That means there is a stoichiometrical correlation between input and output. For other input the relations are depending on the used technology. The output of these substances are a function of the used technology and therefore independent of the specific input. Input dependent parameters are for example the input of C, H, Cl, F, S, N and metals and the emissions caused by these elements. The amount of slag, boiler and filter ash produced is also input dependent. Technology dependent parameters are for example CO, VOC and dioxin emissions, use of adsorbent and the composition of slag, boiler and filter ash."
            });
            var modellingAndValidation = target.modellingAndValidation;
            var lCIMethodAndAllocation = modellingAndValidation.LCIMethodAndAllocation;
            lCIMethodAndAllocation.typeOfDataSet = 4;
            lCIMethodAndAllocation.LCIMethodPrinciple = 1;
            lCIMethodAndAllocation.deviationsFromLCIMethodPrinciple.Add(new StringMultiLang
            {
                lang = "en",
                Value = "None"
            });
            lCIMethodAndAllocation.LCIMethodApproaches.AddRange(new List<int> { 5, 3, 4 });
            lCIMethodAndAllocation.deviationsFromLCIMethodApproaches.Add(new StringMultiLang
            {
                lang = "en",
                Value = "Emissions and also credits for metals are allocated based on the settings for average MSW and the element content of the specific waste treated. For the combined heat and power production, allocation by exergetic content is applied. For the electricity generation and by-products, e.g. gypsum, allocation by market value is applied due to no common physical properties. Within the refinery allocation by net calorific value and mass is used. For the combined crude oil, natural gas and natural gas liquids production allocation by net calorific value is applied."
            });
            lCIMethodAndAllocation.modellingConstants.Add(new StringMultiLang
            {
                lang = "en",
                Value = "All data used in the calculation of the LCI results refer to net calorific value."
            });
            lCIMethodAndAllocation.deviationsFromModellingConstants.Add(new StringMultiLang
            {
                lang = "en",
                Value = "None"
            });
            lCIMethodAndAllocation.referenceToLCAMethodDetails.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("10466572-0cfd-428e-8b10-ae74255e6e83"),
                version = "02.00.000",
                type = 1,
                uri = "../sources/10466572-0cfd-428e-8b10-ae74255e6e83_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new StringMultiLang{  
                        lang="en",
                        Value="GaBi Modelling Principles"
                    }
                }
            });
            var dataSourcesTreatmentAndRepresentativeness = modellingAndValidation.dataSourcesTreatmentAndRepresentativeness;
            dataSourcesTreatmentAndRepresentativeness.dataCutOffAndCompletenessPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "All elements available in the model as input parameters are specified for the incineration good and therefore included. Cut-off rules for each unit process: Coverage of at least 95% of mass and energy of the input and output flows, and 98% of their environmental relevance (according to expert judgment)."
            });
            dataSourcesTreatmentAndRepresentativeness.deviationsFromCutOffAndCompletenessPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "None"
            });
            dataSourcesTreatmentAndRepresentativeness.dataSelectionAndCombinationPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The transfer coefficients for the elements (used to allocate the different elements and substances to the different mediums air, bottom ash, air pollution control residues) and the energy and utility consumption of the waste-to-energy plant are determined based on industry data (real plant data) and a comprehensive literature research. LCI modelling is fully consistent."
            });
            dataSourcesTreatmentAndRepresentativeness.deviationsFromSelectionAndCombinationPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "None"
            });
            dataSourcesTreatmentAndRepresentativeness.dataTreatmentAndExtrapolationsPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The transfer coefficients of some heavy metals are extrapolated from elements with comparable behaviour."
            });
            dataSourcesTreatmentAndRepresentativeness.deviationsFromTreatmentAndExtrapolationPrinciples.Add(new StringMultiLang
            {
                lang = "en",
                Value = "None"
            });
            dataSourcesTreatmentAndRepresentativeness.referenceToDataSource.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("78349260-33a3-11dd-bd11-0800200c9a66"),
                version = "02.00.000",
                type = 1,
                uri = "../sources/78349260-33a3-11dd-bd11-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new StringMultiLang{  
                        lang="fr",
                        Value="MODECOM  Méthode de Caractérisation des Ordures Ménagères, période 2003-2006, 2006"
                    }
                }
            });
            dataSourcesTreatmentAndRepresentativeness.percentageSupplyOrProductionCovered = 95.0M;
            dataSourcesTreatmentAndRepresentativeness.dataCollectionPeriod.Add(new StringMultiLang
            {
                lang = "en",
                Value = "2000-2006"
            });
            dataSourcesTreatmentAndRepresentativeness.useAdviceForDataSet.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The data set represents an end of-life inventory for the thermal treatment of an average European municipal solid waste (MSW) in an average European Waste-to-Energy (WtE) plant. The data set includes the emissions and resource consumption for the thermal treatment of waste. The behaviour of bottom ash and air pollution control residues on a landfill is considered. Produced electricity and process steam are unconnected (partly terminated). It should be considered that this data set is an approximation to reality. The used model of an average European WtE plant and the average composition of MSW do not exist in reality and efficiencies, emission values, transfer coefficients and elementary composition will differ if a specific WtE plant is used. This data set can be used for the incineration of the mentioned and specified waste."
            });
            var completeness = modellingAndValidation.completeness;
            completeness.completenessProductModel = 1;
            var validation = modellingAndValidation.validation;
            validation.review.Add(new ReviewType
            {
                type = 1,
                scope = new List<ReviewScopeType>{
                    new ReviewScopeType{
                        name=1,
                        method=new List<ReviewScopeMethodType>{
                            new ReviewScopeMethodType{
                                name=5
                            },
                            new ReviewScopeMethodType{
                                name=7
                            }
                        }
                    }
                },
                reviewDetails = new List<StringMultiLang>{
                    new StringMultiLang{
                        lang="en",
                        Value="Inventory: The internal review was done by several iteration steps concerning raw data validation, raw data documentation, representativity, completeness and consistency of modelling with regard to ISO 14040 and 14044.; Documentation: The review of the documentation was performed by Ecobilan and is in compliance with ISO 14040 and 14044. The data set documentation is correct in view of the appropriateness of the information provided. It includes all relevant information in view of data quality and scope of application of the respective LCI result."
                    }
                },
                referenceToNameOfReviewerAndInstitution = new List<GlobalReferenceType>{
                    new GlobalReferenceType{
                        refObjectId=new Guid("623edf96-39d1-4e6f-9892-674c7228546b"),
                        version="02.00.000",
                        type=6,
                        uri="../contacts/623edf96-39d1-4e6f-9892-674c7228546b_02.00.000.xml",
                        shortDescription=new List<StringMultiLang>{
                            new  StringMultiLang{
                                lang="en",
                                Value="PE INTERNATIONAL"
                            }
                        }
                    }
                }
            });
            var complianceDeclarations = modellingAndValidation.complianceDeclarations;
            var compliance = complianceDeclarations.compliance;
            var compliance1 = new ComplianceType();
            compliance.Add(compliance1);
            compliance1.referenceToComplianceSystem = new GlobalReferenceType
            {
                refObjectId = new Guid("88d4f8d9-60f9-43d1-9ea3-329c10d7d727"),
                version = "01.00.000",
                type = 1,
                uri = "../sources/ILCD_Compliance_88d4f8d9-60f9-43d1-9ea3-329c10d7d727_01.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="ILCD Data Network compliance - Entry level phase I"
                    }
                }
            };
            compliance1.approvalOfOverallCompliance = 1;
            compliance1.nomenclatureCompliance = 1;
            compliance1.methodologicalCompliance = 1;
            compliance1.reviewCompliance = 1;
            compliance1.documentationCompliance = 1;
            var administrativeInformation = target.administrativeInformation;
            var commissionerAndGoal = administrativeInformation.commissionerAndGoal;
            commissionerAndGoal.referenceToCommissioner.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("16e9b2c6-3c44-11dd-ae16-0800200c9a66"),
                version = "02.00.000",
                type = 6,
                uri = "../contacts/16e9b2c6-3c44-11dd-ae16-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="CEWEP e.V."
                    }
                }
            });
            commissionerAndGoal.intendedApplications.Add(new StringMultiLang
            {
                lang = "en",
                Value = "This background LCI data set can be used for any types of LCA studies."
            });
            var dataGenerator = administrativeInformation.dataGenerator;
            dataGenerator.referenceToPersonOrEntityGeneratingTheDataSet.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("623edf96-39d1-4e6f-9892-674c7228546b"),
                version = "02.00.000",
                type = 6,
                uri = "../contacts/623edf96-39d1-4e6f-9892-674c7228546b_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="PE INTERNATIONAL"
                    }
                }
            });
            var dataEntryBy = administrativeInformation.dataEntryBy;
            dataEntryBy.timeStamp = DateTime.Parse("2009-02-17T15:11:28+01:00");
            dataEntryBy.referenceToDataSetFormat.Add(new GlobalReferenceType
            {
                refObjectId = new Guid("a97a0155-0234-4b87-b4ce-a45da52f2a40"),
                version = "01.00.000",
                type = 1,
                uri = "../sources/ILCD_Format_a97a0155-0234-4b87-b4ce-a45da52f2a40_01.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="ILCD format"
                    }
                }
            });
            dataEntryBy.referenceToConvertedOriginalDataSetFrom = new GlobalReferenceType
            {
                refObjectId = new Guid("6df7ba00-86d1-11db-b606-0800200c9a66"),
                version = "02.00.000",
                type = 1,
                uri = "../sources/6df7ba00-86d1-11db-b606-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="GaBi databases 2006"
                    }
                }
            };
            dataEntryBy.referenceToPersonOrEntityEnteringTheData = new GlobalReferenceType
            {
                refObjectId = new Guid("623edf96-39d1-4e6f-9892-674c7228546b"),
                version = "02.00.000",
                type = 6,
                uri = "../contacts/623edf96-39d1-4e6f-9892-674c7228546b_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="PE INTERNATIONAL"
                    }
                }
            };
            dataEntryBy.referenceToDataSetUseApproval = new GlobalReferenceType
            {
                refObjectId = new Guid("16e9b2c6-3c44-11dd-ae16-0800200c9a66"),
                version = "02.00.000",
                type = 6,
                uri = "../contacts/16e9b2c6-3c44-11dd-ae16-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="CEWEP e.V."
                    }
                }
            };
            var publicationAndOwnership = administrativeInformation.publicationAndOwnership;
            publicationAndOwnership.dataSetVersion = "02.00.000";
            publicationAndOwnership.permanentDataSetURI = "http://lca.jrc.ec.europa.eu/lcainfohub/datasets/elcd/processes/4f035020-4599-424d-8f48-627b35dd1a7f_02.00.000.xml";
            publicationAndOwnership.workflowAndPublicationStatus = 8;
            publicationAndOwnership.referenceToUnchangedRepublication = new GlobalReferenceType
            {
                refObjectId = new Guid("57bbc510-79c3-11dd-ad8b-0800200c9a66"),
                version = "02.00.000",
                type = 1,
                uri = "../sources/57bbc510-79c3-11dd-ad8b-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="ELCD database 2.0"
                    }
                }
            };
            publicationAndOwnership.referenceToOwnershipOfDataSet = new GlobalReferenceType
            {
                refObjectId = new Guid("16e9b2c6-3c44-11dd-ae16-0800200c9a66"),
                version = "02.00.000",
                type = 6,
                uri = "../contacts/16e9b2c6-3c44-11dd-ae16-0800200c9a66_02.00.000.xml",
                shortDescription = new List<StringMultiLang>{
                    new  StringMultiLang{
                        lang="en",
                        Value="CEWEP e.V."
                    }
                }
            };
            publicationAndOwnership.copyright = true;
            publicationAndOwnership.accessRestrictions.Add(new StringMultiLang
            {
                lang = "en",
                Value = "The data set can be used free of charge by anybody to perform LCA studies, to distribute it to third parties, to convert it to other formats, to develop own data sets etc. as long as the copyright and license conditions for the ELCD data sets and the ILCD format are met that can be accessed via http://lca.jrc.ec.europa.eu. Please note e.g. that reference must be given to the 'Owner of data set' and to the 'ELCD database' plus version number, when using the data set or parts thereof. Please note also, that any modifications/omissions of the data set results in invalidity of any existing 'Official approval of data set by producer/operator', that the impression must be avoided that this would still be a complete ELCD data set, and that the content of further fields has to be adjusted. For details see the aforementioned copyright and license conditions."
            });
            #endregion

            var xml = target.Populate(true);

            xml.Save(@"e:\temp.xml");

            Assert.IsTrue(true);
        }

        /// <summary>
        ///A test for Create
        ///</summary>
        [TestMethod()]
        public void CreateTest()
        {
            XDocument doc = XDocument.Load(@"E:\CODE\ITKE_TFS\LCA\Main\Source\LCAFormatSDK\IKE.LCAFormat\ILCD\sample_process.xml");

            ProcessDataSet target = ProcessDataSet.Create(doc,false);
           
            Assert.AreEqual(
                target.processInformation.dataSetInformation.UUID,
                new Guid("4f035020-4599-424d-8f48-627b35dd1a7f"));
            Assert.AreEqual(
                target.processInformation.quantitativeReference.type,
                1);
            Assert.AreEqual(
                target.processInformation.dataSetInformation.classificationInformation.classification[0].@class.Count,
                2);
            Assert.AreEqual(
                target.exchanges.exchange.Count,
                417);
            Assert.AreEqual(
                target.exchanges.exchange[2].dataSetInternalID,
                2);
            //var xml = target.Populate();

            //xml.Save(@"e:\temp.xml");

        }
    }
}
